pull: add new switch option --disable-static-deltas
authorGiuseppe Scrivano <gscrivan@redhat.com>
Tue, 12 May 2015 08:15:30 +0000 (10:15 +0200)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Wed, 13 May 2015 07:38:04 +0000 (09:38 +0200)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo-static-delta-private.h
src/libostree/ostree-repo.c
src/ostree/ot-builtin-pull.c

index 175e31200969d312bf4328bca469216e47bd402b..19e8d7edf6834486a0ccb025cd66bf733292614f 100644 (file)
@@ -1956,7 +1956,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
             }
 
           additional_metadata = g_variant_get_child_value (pull_data->summary, 1);
-          deltas = g_variant_lookup_value (additional_metadata, "ostree.static-deltas", G_VARIANT_TYPE ("a{sv}"));
+          deltas = g_variant_lookup_value (additional_metadata, OSTREE_SUMMARY_STATIC_DELTAS, G_VARIANT_TYPE ("a{sv}"));
           n = deltas ? g_variant_n_children (deltas) : 0;
           for (i = 0; i < n; i++)
             {
index 0cf2a0bd0893df827e454f7d2b8cc3b5e0022259..4df3b8c684e5bda023c0d31b7bfe2859917c7ed7 100644 (file)
@@ -29,6 +29,8 @@ G_BEGIN_DECLS
 /* 1 byte for object type, 32 bytes for checksum */
 #define OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN 33
 
+#define OSTREE_SUMMARY_STATIC_DELTAS "ostree.static-deltas"
+
 /**
  * OSTREE_STATIC_DELTA_PART_PAYLOAD_FORMAT_V0:
  *
index d823725d68af4f261e1bbbdf51365ea5e9cd375b..0d4f4e2ea272f63238d26ac638a3ef2d51c7c070 100644 (file)
@@ -33,6 +33,7 @@
 #include "ostree-repo-file.h"
 #include "ostree-repo-file-enumerator.h"
 #include "ostree-gpg-verifier.h"
+#include "ostree-repo-static-delta-private.h"
 
 #include <locale.h>
 #include <glib/gstdio.h>
@@ -3668,7 +3669,7 @@ ostree_repo_regenerate_summary (OstreeRepo     *self,
         g_variant_dict_insert_value (&deltas_builder, delta_names->pdata[i], ot_gvariant_new_bytearray (csum, 32));
       }
 
-    g_variant_dict_insert_value (&additional_metadata_builder, "ostree.static-deltas", g_variant_dict_end (&deltas_builder));
+    g_variant_dict_insert_value (&additional_metadata_builder, OSTREE_SUMMARY_STATIC_DELTAS, g_variant_dict_end (&deltas_builder));
   }
 
   {
index 424ba412f87bc18cbed6683eaf47d3899744bc4c..874e6dae183a5c6516347f4d08535113257ce4ea 100644 (file)
 
 static gboolean opt_disable_fsync;
 static gboolean opt_mirror;
+static gboolean opt_disable_static_deltas;
 static char* opt_subpath;
 static int opt_depth = 0;
  
  static GOptionEntry options[] = {
    { "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
+   { "disable-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_disable_static_deltas, "Do not use static deltas", NULL },
    { "mirror", 0, 0, G_OPTION_ARG_NONE, &opt_mirror, "Write refs suitable for a mirror", NULL },
    { "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Only pull the provided subpath", NULL },
    { "depth", 0, 0, G_OPTION_ARG_INT, &opt_depth, "Traverse DEPTH parents (-1=infinite) (default: 0)", "DEPTH" },
@@ -135,6 +137,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
     g_variant_builder_add (&builder, "{s@v}", "depth",
                            g_variant_new_variant (g_variant_new_int32 (opt_depth)));
    
+    g_variant_builder_add (&builder, "{s@v}", "disable-static-deltas",
+                           g_variant_new_variant (g_variant_new_boolean (opt_disable_static_deltas)));
+
     if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder),
                                         progress, cancellable, error))
       goto out;